﻿#include <iostream>
class MoveObject {
public:
    int x;
    int y;
};
class Wolf:public MoveObject {
public:
    void eat() {
        std::cout << "Wolf eat!" << std::endl;
    }
    void bite() {
        std::cout << "Wolf Bite!" << std::endl;
    }
};
class Man :public MoveObject {
public:
    void eat() {
        std::cout << "Man eat!" << std::endl;
    }
};
class WolfMan :public Wolf, public Man {//多重继承
public:
    //using Wolf::eat;//调用Man类的eat函数
    void Change() {//变身
        IsWolf = !IsWolf;
        std::cout << "变身！" << std::endl;
    }
    void eat() {
        if (IsWolf)Wolf::eat();
        else Man::eat();
    }
private:
    bool IsWolf = false;
};
int main()
{
    WolfMan Jack;
    Jack.bite();
    //Jack.Wolf::eat();//指定Wolf的eat函数
    //Jack.Man::eat();//指定Man的eat函数
    Jack.eat();
    Jack.Change();
    Jack.eat();

    Jack.x = 250;//冲突
    Jack.y = 250;//冲突

    Jack.Wolf::x = 250;
    Jack.Man::y = 250;
}